package com.zmyuan.demo.netty.thrift.service;

import com.zmyuan.demo.netty.thrift.FrameworkService;
import com.zmyuan.demo.netty.thrift.ThriftRequest;
import com.zmyuan.demo.netty.thrift.ThriftResponse;
import com.zmyuan.demo.netty.thrift.socket.Media;
import com.zmyuan.demo.netty.thrift.utils.ThriftUtils;

/**
 * Created by zdb on 2017/2/17.
 */
public class FrameworkServiceImpl implements FrameworkService.Iface {
    @Override
    public ThriftResponse execut(ThriftRequest thriftRequest) {
        Object result = null;
        try {
            result = Media.execute(thriftRequest);
            ThriftResponse response = new ThriftResponse();
            response.setBody(ThriftUtils.convertThriftObjToBytes(result));
        return response;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
